<!--这个页面是没登陆的人看到的-->
<!DOCTYPE html>
<html lang="zh-cn">

<head>
	<meta charset="utf-8">
	<title>错位 丨 Misplace - portal</title>
	<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="shortcut icon" href="https://raw.githubusercontent.com/StuGRua/2020_project/main/favicon.ico" type="image/x-icon">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link href="/static/css/newnavbar.css" rel="stylesheet">
	<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
	<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="/static/js/md5.js"></script>
	<!--
	<script>
		function GetUrlParam(paraName) {
			　　	var url = document.location.toString();
			　　　　var arrObj = url.split("?");
			　　　　if (arrObj.length > 1) {
			　　　　　　var arrPara = arrObj[1].split("&");
			　　　　　　var arr;

			　　　　　　for (var i = 0; i < arrPara.length; i++) {
			　　　　　　　　arr = arrPara[i].split("=");

			　　　　　　　　if (arr != null && arr[0] == paraName) {
			　　　　　　　　　　return arr[1];
			　　　　　　　　}
			　　　　　　}
			　　　　　　return "";
			　　　　}
			　　　　else {
			　　　　　　return "";
			　　　　}
			　　	}
		function check(v_psw)
					{
						psw=document.getElementById("res_pass").value;
						if(psw!=v_psw)
						{
							alert("两次密码不相同！");
							document.getElementById("res_submit").disabled="disabled";
						}
						else
						{
							document.getElementById("res_submit").disabled="";
						}
					}
		function enc(id){
							//alert("123");
							//var password = $("#password1").val();
							var password = $(id).val();
							//alert(password);
							var passwd = hex_md5(password);//就是我们要的
							//alert(passwd);
							document.getElementById("password1").value=passwd;
						}
		function enc_all(){
						var password=$("#res_pass1").val();
						var passwd = hex_md5(password);
						document.getElementById("res_pass1").value=passwd;
						var password=$("#res_pass").val();
						var passwd = hex_md5(password);
						document.getElementById("res_pass").value=passwd;

					}
		function encoderOn(){
						$("#encoderFrame").attr("width","300px");
						$("#encoderFrame").attr("height","200px");
						$("#encoderFrame").attr("frameborder","1");
					}
		function encoderOff(){
						$("#encoderFrame").attr("width","0px");
						$("#encoderFrame").attr("height","0px");
						$("#encoderFrame").attr("frameborder","0");
					}
		function copyToText(){
						var a = document.getElementById('encoderFrame').contentWindow.document.getElementById('encoded-area').value;
						alert(a);
						document.getElementById("post_content").value=a;
					}
		function pic_inserted(){
						document.getElementById("reply1").value+="[图片]";
					}
	</script>-->
</head>

<body style="margin-top:0px">
	{% if nologin == '1' %}
	<script>
		alert("登陆后才可进行更多操作.");
	</script>
	{% endif %}
	<script>
		if(GetUrlParam("confirmation_ok")==1){
			alert("邮箱链接验证成功.点击确认后本页面可能关闭.");
			window.open('','_self');
			window.close();
		}
		if(GetUrlParam("err")==1){
			alert("用户名或密码错误.");
		}
	</script>
	<script></script>
	<div class="container-fluid">
		<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
			<div class="container-fluid">
				<div class="navbar-header">
					<button type="button" class="navbar-toggle" data-toggle="collapse"
						data-target="#example-navbar-collapse">
						<span class="sr-only">切换导航</span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</button>
					<a class="navbar-brand" href="/">错位 丨 Misplace</a>
				</div>
				<div class="collapse navbar-collapse" id="example-navbar-collapse">
					<ul class="nav navbar-nav">

						<li class="dropdown" style="display:inline-block;">
							<a href="#" class="dropdown-toggle" data-toggle="dropdown">
								综合版：
								<b class="caret"></b>
							</a>
							<ul class="dropdown-menu">
								<li><a href="/home">时间线</a></li>
								<li><a href="/section/综合">综合</a></li>
								<li><a href="/section/校内">校内</a></li>
								<li><a href="/section/形势与政策">形势与政策</a></li>
								<li><a href="/section/问询">问询</a></li>
								<li><a href="/section/深夜">深夜</a></li>
								<li><a href="/section/其他">其他</a></li>
								<li><a href="/section/反馈">反馈</a></li>
							</ul>
						</li>
						<li class="nav-item">
							<a class="nav-link">{{userip}}</a>
						</li>
						<li class="nav-item dropdown">
							<a class="nav-link" href="#" class="dropdown-toggle" data-toggle="modal"
								data-target="#myModal">
								登陆/注册
								<b class="caret"></b>
							</a>
						</li>
					</ul>
				</div>
			</div>
		</nav>
		<!-- 模态框（Modal） -->
		<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
			aria-hidden="true">
			<div class="modal-dialog" style="">
				<div class="modal-content col-xs-12 col-sm-12 col-md-12 col-lg-12">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							&times;
						</button>
						<h4 class="modal-title" id="myModalLabel">
							登陆/注册
						</h4>
					</div>
					<div class="modal-body">
						<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 panel panel-primary">
							<div class="panel-heading">
								<h3 class="panel-title">登陆</h3>
							</div>
							<div class="panel-body">
								<form class="form-horizontal" role="form" action="/login" method="post">
									<div class="form-group">
										<label for="name" class="col-sm-3 control-label">账号</label>
										<div class="col-sm-9">

											{{ loginform.name(size=20,class="form-control",id="name",placeholder="请输入账号") }}
										</div>
									</div>
									<div class="form-group">
										<label for="pass" class="col-sm-3 control-label">密码</label>
										<div class="col-sm-9">
											{{loginform.password(size=40,type="password",class="form-control",id="password1",placeholder="请输入密码") }}
										</div>
										<hr>
										{{ loginform.csrf_token }}
										<button type="submit" class="btn btn-primary center-block  btn "
											value="Submit" onclick="enc(password1)">登陆</button>
									</div>
								</form>
							</div>

						</div>
						<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 panel panel-danger">
							<div class="panel-heading">
								<h3 class="panel-title">注册</h3>
							</div>
							<div class="panel-body">
								<form class="form-horizontal" role="form" action="/signin" method="post">
									<div class="form-group">
										<label for="name" class="col-sm-3 control-label">用户名</label>
										<div class="col-sm-9">
											{{signinform.name(size=40,class="form-control",id="name",placeholder="用户名")}}
										</div>
									</div>
									<div class="form-group">
										<label for="pass" class="col-sm-3 control-label">密码</label>
										<div class="col-sm-9">
												密码长度需6位及以上非纯数字！
											{{signinform.password1(size=40,type="password",class="form-control",id="res_pass",placeholder="密码长度需6位及以上非纯数字！")}}
										</div>
									</div>
									<div class="form-group">
										<label for="pass" class="col-sm-3 control-label">确认密码</label>
										<div class="col-sm-9">
											{{signinform.password2(size=40,type="password",class="form-control",id="res_pass1",placeholder="请再次输入密码")}}
										</div>
									</div>
									<div class="form-group">
										<label for="pass" class="col-sm-3 control-label">邮箱</label>
										<div class="col-sm-9">
											{{signinform.email(size=40,class="form-control",id="email",placeholder="请输入邮箱")}}
											<span id="ale" class="label label-default"></span>
										</div>
										<hr>
										{{ signinform.csrf_token }}
										<button type="submit" class="btn btn-primary center-block btn btn-danger"
											value="Submit" id="res_submit" onclick="enc_all()">注册</button>
									</div>
								</form>


							</div>
						</div>
					</div>
					<div class="modal-footer col-xs-12 col-sm-12 col-md-12 col-lg-12">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭
						</button>
					</div>
				</div><!-- /.modal-content -->
			</div><!-- /.modal -->
		</div>




		<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="margin-top:60px;">

			<div class="well well-lg">
				<h4>公告</h4>
				<h5>更新内容：对和谐编码的模块进行了迁移（变为全前端，避免多次请求）<br>对非核心功能进行了精简<br>变天了，好冷</h5>
				<br>
			</div>
		</div>

		{% for posts in topped_posts %}
		<hr>

		<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
			<a href="/viewpost/{{posts.id}}">
				<div class="panel panel-default">
					<div class="panel-heading">

						<h3 class="panel-title">

							<p><strong>【置顶】ID:{{posts.id}} [板块：{{posts.section}}] {{posts.title}}[{{posts.replies}}回复]</strong></p>
						</h3>
						<p> <img src="/static/avatars/{{posts.avatar}}.jpg" width="30px" height="auto">{{posts.poster}}</p>
						<p>最后更新{{posts.update_time}}</p>
					</div>
					<div class="panel-body">

						<p>{%if posts.withpic %}
							<img src="/{{posts.pic_route}}" height="100px" width="auto">
							{% endif %}<br>{{posts.content[0:100]}}</p>
					</div>
				</div>

			</a>

		</div>


		{% endfor %}
		{% for posts in tenposts %}
		<hr>

		<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
			<a href="/viewpost/{{posts.id}}" style="text-decoration:none">
				<div class="panel panel-default" >
                    <div class="panel-heading">

                        <h3 class="panel-title">
                            <p><strong>ID:{{posts.id}} [板块：{{posts.section}}] {{posts.title}}</strong>
                            </p>
                                <p><img src="/static/avatars/{{posts.avatar}}.jpg" width="30px" height="auto">{{posts.poster}}</p>
                        </h3>
                        <span class="badge">{{posts.replies}}回复</span><span class="badge">最后更新{{posts.update_time}}</span>
                    </div>
					<div class="panel-body">

						<p>{%if posts.withpic %}
							<img src="/{{posts.pic_route}}" height="100px" width="auto">
							{% endif %}<br>{{posts.content[0:100]}}</p>
					</div>
				</div>

			</a>

		</div>


		{% endfor %}
	</div>
</body>
<!--<script type="text/javascript" src="/static/js/nmb_main.js"></script>-->
</html>